import Taro, {Component} from '@tarojs/taro'
import {View, Button, Text, Swiper, SwiperItem, Image, ScrollView} from '@tarojs/components'
import {connect} from '@tarojs/redux'
import {
  set_userinfo, set_cart, set_goodslist, set_viplist, set_bind_car_num, set_progress,
  set_pushdata, set_pushdatanum, gohome_btn, set_cart_num,
} from '../../actions/IndexAction'
import base from "../base"
import {AtTabs, AtTabsPane, AtSearchBar} from 'taro-ui'
import './index.less'
import set from "../../apis/api"

class add_devices_one extends Component {
  constructor(props) {
    super(props)
    base(this)
    this.state = {
      current: 0,
      value: ""
    }
  }

  config = {
    navigationBarTitleText: '添加设备',
    enablePullDownRefresh: true,
    navigationBarBackgroundColor: "#4bb33d",
    navigationBarTextStyle: "white"

  }

  onReachBottom() {


  }


  componentWillReceiveProps(nextProps) {
    console.log(this.props, nextProps)
  }

  onPullDownRefresh() {
    wx.stopPullDownRefresh();
  }

  componentWillUnmount() {
  }

  componentDidShow() {
    this.onPullDownRefresh()


  }

  back() {
    Taro.navigateBack()
  }

  fetchData() {


    // wx.showLoading({title: "加载中"})
    // var databody={
    //   openid:this.props.wxuser.wxuser.openid,
    //   id:this.$router.params.id
    // }
    // this.wx_request(set.oto.getotoorder, databody,"POST", {'Content-Type': 'application/x-www-form-urlencoded'}).then((data)=>
    // {
    //
    //
    //   wx.stopPullDownRefresh();
    //   wx.hideLoading();
    //
    // }).catch((err)=>{
    //   wx.hideLoading();
    //   wx.stopPullDownRefresh();
    //   wx.showToast({
    //     title: '网络访问失败，请重试',
    //     icon: 'none',
    //     duration: 1800
    //   })
    // })

  }

  componentDidHide() {
  }

  render() {
    const tabList = [{title: '未处理'}, {title: '已处理'}]
    return (
      <View style={{flex: 1, display: "flex", flexDirection: "column", padding: "20rpx"}}>
        <View style={{borderBottom: "2rpx #cccccc solid", display: "flex", flex: 1}}>
          <View style={{flex: 1, paddingBottom: "5rpx", paddingTop: "10rpx"}}>
            <Text style={{fontSize: "24rpx", color: "#666666"}}>
              设备名称:
            </Text>
          </View>
          <View
            style={{flex: 1, paddingBottom: "10rpx", paddingTop: "10rpx", display: "flex", justifyContent: "flex-end"}}>
            <View style={{
              padding: "5rpx 40rpx 5rpx 40rpx",
              backgroundColor: "#cccccc",
              display: "flex",
              alignItems: "center",
              justifyContent: "center",
              borderRadius: "5rpx"
            }}>
              <Text style={{fontSize: "24rpx", color: "#666666"}}>
                设备名称
              </Text>
            </View>

          </View>
        </View>
        <View style={{borderBottom: "2rpx #cccccc solid", display: "flex", flex: 1}}>
          <View style={{flex: 1, paddingBottom: "5rpx", paddingTop: "10rpx"}}>
            <Text style={{fontSize: "24rpx", color: "#333333"}}>
              设备串码:
            </Text>
          </View>
          <View
            style={{flex: 1, paddingBottom: "10rpx", paddingTop: "10rpx", display: "flex", justifyContent: "flex-end"}}>
            <View style={{
              padding: "5rpx 40rpx 5rpx 40rpx",
              backgroundColor: "#cccccc",
              display: "flex",
              alignItems: "center",
              justifyContent: "center",
              borderRadius: "5rpx"
            }}>
              <Text style={{fontSize: "24rpx", color: "#666666"}}>
                设备名称
              </Text>
            </View>

          </View>
        </View>
        <View style={{borderBottom: "2rpx #cccccc solid", display: "flex", flex: 1}}>
          <View style={{flex: 1, paddingBottom: "5rpx", paddingTop: "10rpx"}}>
            <Text style={{fontSize: "24rpx", color: "#333333"}}>
              设备状态:
            </Text>
          </View>
          <View
            style={{flex: 1, paddingBottom: "10rpx", paddingTop: "10rpx", display: "flex", justifyContent: "flex-end"}}>
            <View style={{
              padding: "5rpx 40rpx 5rpx 40rpx",
              backgroundColor: "#cccccc",
              display: "flex",
              alignItems: "center",
              justifyContent: "center",
              borderRadius: "5rpx"
            }}>
              <Text style={{fontSize: "24rpx", color: "#333333"}}>
                设备名称
              </Text>
            </View>

          </View>
        </View>
        <View style={{display: "flex", alignItems: "center",flexDirection:"column",border:"2rpx solid #cccccc",borderRadius:"10rpx",marginTop:"30rpx"}}>

          <View style={{
            paddingLeft: "10px",
            backgroundImage: `url("../../assets/images/icon_14.png")`,
            backgroundRepeat: "no-repeat",
            backgroundSize: "100% 100%",
            width: "150rpx",
            height: "150rpx",
            marginTop: "50rpx"
          }}>


          </View>
          <View style={{margin: "30rpx", display: "flex", alignItems: "center", justifyContent: "center"}}>
            <Text style={{color: "#999999", fontSize: "24rpx"}}>
              请拍摄基站图
            </Text>

          </View>
        </View>





        <View style={{margin: "50rpx", display: "flex", alignItems: "center", justifyContent: "center"}}>

          <View style={{
            width: "300rpx", height: "70rpx", borderRadius: "35rpx", backgroundColor: "#ae5da0", alignItems: "center",
            justifyContent: "center", display: "flex", flex: 1
          }}>
            <Text style={{color: "#ffffff", fontSize: "26rpx"}}>立即上传</Text>
          </View>

        </View>
      </View>
    )
  }
}

const mapstate = state => {
  return {
    userinfo: state.usermodel,
    cart_num: state.cart_num,
    cart: state.cart,
    goodslist: state.goodslist,
    vip: state.vip,
    progress: state.progress,
    pushdata: state.pushdata,
    wxuser: state.wxusermodel,sys_config:state.sys_config
  }
}
export default connect(mapstate)(add_devices_one)

